<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户信息</title>
    <style>
        body {
            background-image: url('user.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-attachment: fixed;
            color: #EC1213;
            font-family: 'EB Garamond', serif;
            margin: 0;
            padding: 0;
            background-color: #88DB48;
            text-align: center;
            padding: 50px;
        }
        h1 {
            color: #88DB48;
        }
        .info {
            font-size: 20px;
            margin: 20px 0;
        }
        .backButton {
            padding: 10px 20px;
            font-size: 16px;
            background-color: #88DB48;
            color: white;
            border: none;
            cursor: pointer;
            border-radius: 5px;
        }
        .backButton:hover {
            background-color: #C4E83A;
        }
    </style>
</head>
<body>
    <h1>用户信息</h1>
    <div class="info">
        <p id="username"></p>
        <p id="password"></p>
    </div>
    <button class="backButton" onclick="goBack()">返回</button>

    <script>
        function getQueryParams() {
            const params = {};
            const queryString = window.location.search.substring(1);
            const regex = /([^&=]+)=([^&]*)/g;
            let m;
            while (m = regex.exec(queryString)) {
                params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
            }
            return params;
        }

        const params = getQueryParams();
        console.log(params); // 调试输出
        document.getElementById('username').textContent = `昵称: ${params.username}`;
        document.getElementById('password').textContent = `密码: ${params.password}`;

        function goBack() {
            window.history.back(); // 返回到上一页
        }
    </script>
</body>
</html>
